/**
 * Copyright (C) 2010 Alfredo Morresi
 * 
 * This file is part of RainbowLibs project.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *    http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package it.rainbowbreeze.libs.data;

import java.io.IOException;
import java.util.HashMap;

import org.apache.http.client.ClientProtocolException;

public interface IRainbowWebserviceClient {

    /**
     * Send to the webservice a GET request
     * 
     * @param url
     *            the Url of the webservice
     *            
     * @return the string returned from the webservice
     *
     * @throws IOException 
     * @throws ClientProtocolException 
     */
    public String requestGet(String url) throws ClientProtocolException,
            IOException;

    /**
     * Send to the webservice a POST request
     * 
     * @param url the Url of the webservice
     * @param parameters the data to pass in post via parameters
     * @param headers the data to pass in post via headers
     *
     * @return the string returned from the webservice
     * 
     * @throws IOException 
     * @throws ClientProtocolException 
     */
    public String requestPost(String url, HashMap<String, String> headers,
            HashMap<String, String> parameters) throws ClientProtocolException,
            IOException, IllegalArgumentException;

    /**
     * Start a conversation, where cookies and other states are
     * preserver between a request (get or post) and the following
     * 
     * To stop a conversation, call stopConversation
     */
    public void startConversation();

    /**
     * End a conversation previously started
     */
    public void endConversation();

}